'use strict';
(function(){
  var app = angular.module('store',[]);
  app.controller('StoreController',['$http',function($http){
    this.products = phones;
    this.productDefault = phones[0];
    
    this.switch01 = 0;
    this.content01 = "Advance Options";
    this.show01 = "Advance Options";
    this.hide01 = "Hide";
    var form = this;
    
    this.showBlock = function(){
    	var res = (form.switch01%2 === 1);
    	if(res){
    		form.content01 = form.hide01;
    	}else{
    		form.content01 = form.show01;
    	}
    	return res;
    };
    
    this.increase01 = function(){
    	form.switch01 = form.switch01 + 1;
    };
    
    $http.get('/env.wss',{appName: 'SQO'}).then(
    		function(response){
    			if(response.status == 200){
    				form.products = response;
    			}
    		},function(response){
    			
    		});
    
  }]);
  app.controller('searchResult',['$http',function($http){
	  this.logDetail = [];
	  var configScope = this;
//	  $http({method: get,url: ''});
	  this.search = function(){
	    $http.get('/search.wss',{env: 'fvt', startDate: '2015-08-31', endDate: '2015-09-02', searchText: 'aaa'})
	    .then(
	    function(response){
	    	alert(response.status);
	    	alert(response.statusText);
	    	if(response.status === 200){
	    		configScope.logDetail = response.data;
	    	}
	    },
	    function(response){
	    	
	    });
	  };
  }]);
  
  var comments = [{'name': 'format','type': 'String', 'default': '\'mm/dd/yyyy\'', 'description': 'the date format, combination of  d, dd, m, mm, yy, yyy.'},
                  {'name': 'weekStart','type': 'integer', 'default': '0', 'description': 'day of the week start. 0 for Sunday -  6 for Saturday.'}
  ];
  var phone = {name: "Nexus S",
         snippet: "Fast just got faster with Nexus S."};
  var phones = [
        {group: "FVT",
         name: "fvt"},
        {group: "UAT",
         name: "uat01"},
        {group: "UAT",
    	 name: "uat02"},
    	{group: "UAT",
         name: "uat03"},
		{group: "UAT",
		 name: "uat04"},
        {group: "PS",
         name: "ps01"},
        {group: "PS",
         name: "ps02"},
        {group: "PROD",
         name: "prod001"},
        {group: "PROD",
    	 name: "prod002"},
    	{group: "PROD",
    	 name: "prod003"},
        {group: "PROD",
         name: "prod004"}
      ];
})();


